package com.javaspirit.android.diary.dal;

import android.database.sqlite.SQLiteDatabase;
import android.provider.BaseColumns;
import android.util.Log;

public final class NoteTable{
	
	private static final String TAG = "NoteTable";
	
	public static final String TABLE_NAME = "note";
	
	public static final String COLUMN_ID = BaseColumns._ID;
	public static final String COLUMN_NOTE = "note";
	public static final String COLUMN_MOOD = "mood";
	public static final String COLUMN_WEATHER = "weather";
	public static final String COLUMN_DATE = "date";
	public static final String COLUMN_LAST_MOD_TS = "last_modified_ts";
	
	private static final String TABLE_CREATE = String.format(
			"create table %s (%s integer primary key autoincrement, %s text, %s integer, %s integer, %s integer, %s interger)",
			TABLE_NAME, COLUMN_ID, COLUMN_NOTE, COLUMN_MOOD, COLUMN_WEATHER, COLUMN_DATE, COLUMN_LAST_MOD_TS);
	
	public static void onCreate(SQLiteDatabase db) {
		db.execSQL(TABLE_CREATE);
		Log.i(TAG, TABLE_NAME+" created");
	}

	public static void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		//db.execSQL("DROP TABLE IF EXISTS note");
		//onCreate(db);
		//Log.i(TAG, TABLE_NAME+" upgraded from "+oldVersion+" to "+newVersion);
	}
	
}
